#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int n,cnt;
int a[200005],b[200005],c[200005];
int d[200005],e[200005];
int main()
{
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	cin>>n;int n2=n;
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		d[i]=i;
	}
	for(int i=1;;i++)
	{
		int o=0;
		for(int j=1;j<=n;j++)
		{
			if(a[j]!=a[j-1]&&!b[j])
			{printf("%d ",d[j]);b[j]=1;cnt++;}
		}
		for(int j=1;j<=n;j++)
		{
			if(!b[j])
			c[++o]=a[j],e[o]=d[j];
		}memset(b,0,sizeof(b));
		for(int j=1;j<=o;j++)a[j]=c[j],d[j]=e[j];
		cout<<endl;n=o;
		if(cnt>=n2)break;
	}
	return 0;
}
